package com.xbongbong.saas.domain.entity;

import com.xbongbong.paas.toolbox.util.DateUtil;
import com.xbongbong.saas.enums.mini.DingRobotManagePushEnum;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * @author chenshan
 * @version 1.0
 * @date 2020-08-31
 * @since 群机器人管理
 */
@Setter
@Getter
@ToString
public class DingRobotManageEntity {
    private static final long serialVersionUID = -8164395867653509756L;
    private Long id;
    private String corpid;
    /**
     * 群编号
     */
    private String openConversationId;
    /**
     * 系统群编号
     */
    private Long bundleId;
    /**
     * 机器人编号
     */
    private Long robotId;
    /**
     * 机器人名称
     */
    private String title;
    /**
     * 机器人别称
     */
    private String alias;
    /**
     * 是否启用，1:启用，0:关闭
     */
    private Integer enable;
    /**
     * 是否可设置，1:可以，0:不可以
     */
    private Integer setUp;
    /**
     * 统计时间
     */
    private String statisticsDeadline;
    /**
     * 推送时间
     */
    private String pushTime;
    /**
     * 备注
     */
    private String memo;
    /**
     * 新增时间
     */
    private Long addTime;
    /**
     * 更新时间
     */
    private Long updateTime;
    /**
     * 是否删除
     */
    private Integer del;
    
    public DingRobotManageEntity() {
        long now = DateUtil.getLong();
        enable = 1;
        addTime = now;
        updateTime = now;
        del = 0;
    }
    
    public DingRobotManageEntity(DingRobotManagePushEnum managePushEnum, Long bundleId ) {
        this.bundleId = bundleId;
        title = managePushEnum.getName();
        alias = managePushEnum.getAlias();
        enable = managePushEnum.getEnable();
        setUp = managePushEnum.getSetUp();
        statisticsDeadline = managePushEnum.getStaticsTime();
        pushTime = managePushEnum.getPushTime();
        memo = managePushEnum.getDescribe();
        long now = DateUtil.getLong();
        addTime = now;
        updateTime = now;
        del = 0;
    }
    
    public DingRobotManageEntity(DingRobotManagePushEnum managePushEnum, String openConversationId ,Long bundleId) {
        this.openConversationId = openConversationId;
        this.bundleId = bundleId;
        title = managePushEnum.getName();
        alias = managePushEnum.getAlias();
        enable = managePushEnum.getEnable();
        setUp = managePushEnum.getSetUp();
        statisticsDeadline = managePushEnum.getStaticsTime();
        pushTime = managePushEnum.getPushTime();
        memo = managePushEnum.getDescribe();
        long now = DateUtil.getLong();
        addTime = now;
        updateTime = now;
        del = 0;
    }
}
